import json

path = "E:/data/Knowledge_extraction/train_data.json"

with open(path, "r", encoding="utf-8") as f:
    lines = f.readlines()

with open("./datas/train1.json", "w", encoding="utf-8") as f:
    for line in lines[:-500]:
        f.write(line)

with open("./datas/dev1.json", "w", encoding="utf-8") as f:
    for line in lines[-500:]:
        f.write(line)